#pragma once

#include "map/map.h"

class BattleGroundMap : public Map
{
private:
    using Map::GetPersistentState;                      // hide in subclass for overwrite
public:
    BattleGroundMap(unsigned int id, time_t, unsigned int InstanceId);
    ~BattleGroundMap();
    void Update(const unsigned int&) override;
    bool Add(battle::object::Player*) override;
    void Remove(battle::object::Player*, bool) override;
    bool CanEnter(battle::object::Player* player) override;
    void SetUnload();
    void UnloadAll(bool pForce) override;

    virtual void InitVisibilityDistance() override;
    BattleGround* GetBG() { return m_bg; }
    void SetBG(BattleGround* bg) { m_bg = bg; }

#if 0
    unsigned int GetScriptId() const override { return sScriptMgr.GetBoundScriptId(SCRIPTED_BATTLEGROUND, GetId()); } //TODO bind BG scripts through script_binding, now these are broken!
#endif

    // can't be nullptr for loaded map
    BattleGroundPersistentState* GetPersistanceState() const;

private:
    BattleGround* m_bg;
};
